import request from '@/request';
import type { editFormData, addFormData } from '../@types/index';

/**获取文章列表*/
export const getArticle = (params: {
    page?: number,
    pageSize?: number,
    title?: string,
    isAll?: boolean,
    type?: string,
    brfie?: string
}) => {
    return request({
        url: '/api/v2/admin/getArticle',
        method: 'get',
        params
    })
}

/**根据ID获取文章详情*/
export const getArticleById = (params: { ID: string }) => {
    return request({
        url: '/api/v2/admin/getArticleById',
        method: 'get',
        params
    })
}

/**添加文章*/
export const addArticle = (data: addFormData) => request({
    url: '/api/v2/admin/addArticle',
    method: 'post',
    data
})

/**删除文章*/
export const delArticle = (data: { ID: string }) => request({
    url: '/api/v2/admin/delArticle',
    method: 'post',
    data
})

/**更新文章信息*/
export const updataArticle = (data: editFormData) => request({
    url: '/api/v2/admin/updataArticle',
    method: 'post',
    data
})